//
//  JGCrashMonitor.h
//  JGCrashMonitor
//
//  Created by jagger.tu on 2024/11/19.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class JGCrashMonitor;

@protocol JGCrashMonitorDelegate <NSObject>

@optional

/// 上报奔溃时调用
/// - Parameters:
///   - crashMonitor: 上报奔溃对象 -- 无实际意义
///   - crash: 奔溃信息
- (void)crashMonitor:(JGCrashMonitor *)crashMonitor reportCrash:(NSDictionary *)crash;

@end

/// 奔溃监听者,是一个单例
@interface JGCrashMonitor : NSObject

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/// 上报代理,检查到存在未上报的奔溃时会调用
@property (nonatomic, weak) id<JGCrashMonitorDelegate> delegate;

/// 用户信息
@property (nonatomic, strong, nullable) NSDictionary *userInfo;

/// 获取一个共享实例
+ (instancetype)sharedInstance;

/// 当前版本
+ (NSString *)version;

/// 安装崩溃监听
- (void)install;


@end

NS_ASSUME_NONNULL_END

//! Project version number for JGCrashMonitor.
FOUNDATION_EXPORT double JGCrashMonitorVersionNumber;

//! Project version string for JGCrashMonitor.
FOUNDATION_EXPORT const unsigned char JGCrashMonitorVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <JGCrashMonitor/JGCrashMonitor.h>


